package com.persistencia.util;


import java.io.File;
import java.io.IOException;
import java.util.List;

import com.exceptions.PersistenceException;


public abstract class RecordStrategy {
	protected String FILE_NAME;
	
	private Class<?> classType;
	
	
	public RecordStrategy(Class<?> classType) {
		FILE_NAME = "data/";
		this.classType = classType;
	}
	
	public abstract Boolean writeData(List<?> list) throws PersistenceException;
	
	public abstract List<?> readData() throws PersistenceException;
	
	public String getClassTypeName() {
		return classType.getName();
	}
	
	public void createFile() throws IOException {
		File file = new File(FILE_NAME);
		if (!file.exists()) {
			file.createNewFile();
		}
		
	}
}
